Skip to content

Follow-up to P2546, "Debugging Support" #7642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 15, 2025

Conversation

hubert-reinterpretcast
Copy link
Contributor

@hubert-reinterpretcast hubert-reinterpretcast commented Feb 14, 2025

Follow-up to #6681 (P2546R5) from thread beginning with edit/2023/11/0870.

  • The notes in the paper make statements of fact about behaviour that, normatively, is implementation-defined. These should instead be statements of intent.
  • The description of breakpoint assumes that a debugger is present (and should instead cover both cases).
  • The odd restriction on how the debugger resumes execution of the program needs elaboration.
  • The description of the implementation strategy of is_debugger_present for POSIX makes assumptions that are more appropriate for the LSB.
  • The terminology used in the LSB is "tracing process", not "tracer parent process".
  • The note in is_debugger_present implies the wrong trade-off when it is unknown whether a debugger is present. Clarify to prefer returning false.

Hubert Tong added 6 commits February 13, 2025 17:44
The note in `breakpoint` makes a statement of fact about the
implementation-defined behaviour. The statement is actually one of
intent.
Regarding `breakpoint`:
The specific claim that the debugger resumes execution of the program as
if the function was not invoked is confusing considering that the
debugger may effect side-effects or cause execution to resume from a
different evaluation.

Instead, the idea is that `breakpoint` is not responsible for causing
the translation process to make special accomodations for resumption of
execution other than in cases where the debugger was strictly used for
observation only.
Describe the possibility of abend.
The note in the description of `is_debugger_present` reads as a
statement of fact about the normatively implementation-defined
behaviour. Fix this to read as a statement of intent.
The functionality ascribed to POSIX by the wording is not present in
POSIX. Update to reference the LSB and to use the corresponding
terminology.
The wording implies a preference to return `true` in case it is unknown
whether a debugger is present. Add a critical "only" to fix that.
@hubert-reinterpretcast
Copy link
Contributor Author

@jwakely @grafikrobot, this is the follow-up from the November 2023 discussion.

@Dani-Hub
Copy link
Member

@hubert-reinterpretcast What is the meaning of "abend" in the program can abend? Should that be "terminate" instead? (I think we have banned the word "abort" unless we specifically refer to std::abort)

@W-E-Brown
Copy link
Contributor

W-E-Brown commented Feb 14, 2025 via email

@jwakely
Copy link
Member

jwakely commented Feb 14, 2025

I agree it's an established term, but if it's not well known then it doesn't help in a note that's intended to add clarification. Otherwise this looks like a good improvement.

@Dani-Hub
Copy link
Member

Dani-Hub commented Feb 14, 2025

"Abend" is a shortened form of "abnormal end." The term is of fairly long standing; I recall it from at least the 1960's when it was used by and in connection with IBM 360 systems software, and it may date from even earlier. When a program "abends," it terminates, often (typically?) for unforeseen reasons.

Thanks for the explanation. Could we possibly replace "the program can abend" by "the program can end abnormally" instead?

Address review feedback ("abend" is not a well-known term).
@hubert-reinterpretcast hubert-reinterpretcast changed the title P2546 follow up Follow-up to P2546, "Debugging Support" Feb 14, 2025
Copy link
Contributor

@grafikrobot grafikrobot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @hubert-reinterpretcast for the improved wording.

Copy link
Member

@jensmaurer jensmaurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did I mention that I was opposed to adding those functions to start with? A note is obviously not the right tool to specify them, but we lack the normative framework to put the specification in a "recommended practice". (end of rant)

@jwakely should see this change.

only when tracing the execution of the program with a debugger. On Windows or
equivalent systems, this can be achieved by calling the
\tcode{::IsDebuggerPresent()} Win32 function. For systems compatible with
ISO/IEC 23360:2021, this can be achieved by checking for a tracing process, with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This replaces "POSIX" with "Linux Standard Base". Is there a particular reason for that? Does POSIX not cover the needed functionality?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although ptrace is present in most UNIX-like systems, it isn't part of POSIX. The LSB is a much narrower scope than POSIX, but it is a standard, unlike families like "BSD" or "SysV". So if we want a standard that includes ptrace, LSB makes sense.

However, the wording never mentions prrace it just talks about "tracing" and "a tracer parent process" which is still meaningful even in e.g. HP-UX which replaced ptrace with ttrace, and in Solaris through ptrace but also via procfs. So maybe it's OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, the wording never mentions prrace it just talks about "tracing" and "a tracer parent process" which is still meaningful even in e.g. HP-UX which replaced ptrace with ttrace, and in Solaris through ptrace but also via procfs. So maybe it's OK.

Using "POSIX" in conjunction with the handwaving implies that the handwaving is necessarily meaningful for all possible implementations of POSIX. That it is probably meaningful for extant implementations of POSIX does not make me feel any better about using "POSIX" without qualification.

@jensmaurer jensmaurer requested a review from jwakely February 16, 2025 20:09
Copy link
Member

@jwakely jwakely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the change to refer to the LSB. What does it imply for e.g. macOS, which is not Windows and isn't compatible with the LSB either?

Not that "On POSIX" was really great wording either.

@hubert-reinterpretcast
Copy link
Contributor Author

I don't love the change to refer to the LSB. What does it imply for e.g. macOS, which is not Windows and isn't compatible with the LSB either?

Not that "On POSIX" was really great wording either.

I would like to err on the side of "saying nothing wrong". Which is to say that, saying nothing for macOS (or any other non-Windows, non-LSB platform) leaves people the freedom to see whether the LSB implementation hint can be adapted for macOS, etc. without implying that the hint is applicable in cases where it isn't.

@jwakely
Copy link
Member

jwakely commented Feb 16, 2025

Yeah that makes sense

@hubert-reinterpretcast
Copy link
Contributor Author

@jensmaurer @jwakely, are we good with the current proposed change then?

@jensmaurer jensmaurer added the after-motions Pull request is to be applied after the pending edits from WG21 straw polls have been applied. label Feb 25, 2025
@jensmaurer jensmaurer added this to the post-2025-02 milestone Feb 25, 2025
@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 15, 2025

Is all this to be squashed?

@jensmaurer
Copy link
Member

Yes, please squash and fix the commit message.

@tkoeppe tkoeppe merged commit ec10aae into cplusplus:main Mar 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
after-motions Pull request is to be applied after the pending edits from WG21 straw polls have been applied.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants